# -*- coding:utf-8 -*-
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import List, Literal, Optional, Union
from module_admin.annotation.pydantic_annotation import as_query


class BgOrderModel(BaseModel):
    """
    表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True, populate_by_name=True)
    create_by: Optional[int] =  Field(default=None, description='创建者')
    create_time: Optional[datetime] =  Field(default=None, description='创建时间')
    begin_create_time: Optional[datetime] =  Field(default=None, description='创建时间最小值')
    end_create_time: Optional[datetime] =  Field(default=None, description='创建时间最大值')
    del_flag: Optional[str] =  Field(default=None, description='删除标志')
    dept_id: Optional[int] =  Field(default=None, description='部门id')
    id: Optional[int] =  Field(default=None, description='id')
    update_time: Optional[datetime] = Field(default=None, description='更新时间')

    product_id: Optional[int] =  Field(default=None, description='产品ID')
    product_month: Optional[int] =  Field(default=None, description='产品周期')
    product_name: Optional[str] =  Field(default=None, description='产品名称')
    product_pay: Optional[int] =  Field(default=None, description='产品实付')
    product_price: Optional[int] =  Field(default=None, description='产品价格')
    status: Optional[str] =  Field(default='0', description='订单状态（0未支付，1已支付，2已退款）')
    pay_wx_code: Optional[str] = Field(default=None, description='微信付款码')

    user_id: Optional[int] =  Field(default=None, description='用户ID')
    order_no: Optional[str] =  Field(default=None, description='订单号')
    payment_method: Optional[str] =  Field(default=None, description='支付方式')
    payment_time: Optional[datetime] =  Field(default=None, description='支付时间')
    refund_time: Optional[datetime] =  Field(default=None, description='退款时间')
    refund_reason: Optional[str] =  Field(default=None, description='退款原因')
    user_name: Optional[str] =  Field(default=None, description='用户名称')
    user_phone: Optional[str] =  Field(default=None, description='用户手机')



@as_query
class BgOrderPageModel(BgOrderModel):
    """
    分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class BgOrderCreateModel(BaseModel):
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True, populate_by_name=True)
    product_id: Optional[int] = Field(default=None, description='产品ID')


from typing import Optional

from pydantic import BaseModel, Field


class PhoneMsgReq(BaseModel):
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True, populate_by_name=True)
    msg_from: Optional[str] = Field(default=None,description='短信来源手机号')
    msg_content: Optional[str] = Field(default=None,description='短信/通知内容')
    req_time: Optional[str] = Field(default=None,description='请求时间戳，毫秒')
    card_slot: Optional[str] = Field(default=None,description='标题')
    receive_time: Optional[str] = Field(default=None,description='短信/通知到达时间')
